@extends('backstage.layout.master')
@section('title', '产品列表')
@section('style')
    <link rel="stylesheet" href="css/order.css"/>
    <style>
        a{
            cursor: pointer;
        }
    </style>
@stop
@section('content')
    <div class="breadcrumbs" id="breadcrumbs">
        <script type="text/javascript">
            try {
                ace.settings.check('breadcrumbs', 'fixed')
            } catch (e) {
            }
        </script>

        <ul class="breadcrumb">
            <li>
                <i class="icon-home home-icon"></i>
                <a href="backstage/home">主页</a>
            </li>

            <li class="active">
                <a href="backstage/types/list">主题列表</a>
            </li>
            <li>
                产品列表
            </li>
        </ul><!-- .breadcrumb -->
    </div>

    <div class="page-content">
        <div class="page-header">
            <h1>
                产品列表
            </h1>
            <a href="backstage/types/add-product/{{$type_id}}">
                <button class="btn btn-danger add-btn-danger" style="float: right;">添加</button>
            </a>
        </div>
        <div class="row">
            <div class="col-xs-12">
                <!-- PAGE CONTENT BEGINS -->
                <div class="table-responsive">
                    <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                        <thead>
                        <tr>
                            <th>降序排列</th>
                            <th>产品编号</th>
                            <th>产品预览图</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>

                        <tbody>
                        @foreach ($products as $product)
                        <tr>
                            <td style="width:68px;">
                                <input type="text" name="sort" value="{{$product->sort}}" class="sort"
                                       style="width:50px;" data="{{$product->sort}}"
                                       onblur="if(this.value != this.getAttribute('data')){window.location.href='backstage/types/update-product-sort/?type_id={{$type_id}}&product_id={{$product->product->product_id}}&sort='+this.value}">
                            </td>
                            <td>{{$product->product->product_id}}</td>
                            <td>
                                <img src="{{$product->product->thumbnail_image}}" style="width: 120px;"/>
                            </td>
                            <td>
                                @if($product->product->is_shelves == 0)
                                    <div class="red">已下架</div>
                                    @elseif($product->product->is_show == 0)
                                    <div class="red">隐藏</div>
                                    @else
                                    上架
                                @endif
                            </td>
                            <td>
                                <a class="blue" href="backstage/types/delete-product/{{$type_id}}/{{$product->product->product_id}}">删除</a>
                            </td>
                        </tr>
                        @endforeach
                        </tbody>
                    </table>
                </div>
                <div class="row">
                    <div class="col-sm-6">
                        <div class="dataTables_info" id="sample-table-2_info"></div>
                    </div>
                    <div class="col-sm-6">
                        <div class="dataTables_paginate paging_bootstrap">
                            <?php echo $products->render(); ?>
                        </div>
                    </div>
                </div>
                            <!-- PAGE CONTENT ENDS -->
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.page-content -->
@stop
@section('script')

@stop